<!-- UserController.php-->
<?php 
	require 'Model/SoModel.php';
	require 'Controller.php';
	class SoController extends Controller{
		public $model;
		function __Construct(){
			parent::__Construct();
			$this->model = new SoModel();
		}
		function society(){
			$model = new SoModel();
			$data = $model->getSoList();
			//转向用户列表页面
			$this->assign('society',$data);
			$this->display();
		}

		function soform(){
			//转向添加用户页面
			include 'View/So/soform.php';
		}

		function societyedit(){
			$id = $_GET['id'];
			$model = new SoModel();
			$result = $model->getUserByID($id);
			include 'View/So/societyedit.php';
		}

		function societysearch(){
			$activity = $_POST['activity'];
			$model = new SoModel();
			$data = $model->getsocietyinfor($activity);
			include 'View/So/search.php';
		}

		function societyupdate(){
			$id = $_GET['id'];
			$model = new SoModel();
			$result = $model->Updatesociety($id);
			if($result){
				echo '修改成功'.'<a href="Admin.php?c=So&m=society">如果没有跳转，请点这里跳转</a>';
				header("refresh:3;Admin.php?c=So&m=society = Admin.php?c=So&m=society"); 	
			}else{
				echo '失败';
			}
		}

		function delsociety(){
			$id = $_GET['id'];
			$model = new Somodel();
			$result = $model->Delsociety($id);
			if($result){
				echo '删除成功'.'<a href="Admin.php?c=So&m=society">如果没有跳转，请点这里跳转</a>';
				header("refresh:3;Admin.php?c=So&m=society = Admin.php?c=So&m=society"); 
			}else{
				echo '删除失败';
			}
		}

		function addso(){
			//获取表单的数据
			//调用model中的addUser方法，添加到数据库中
			//var_dump($_POST);
			$data = $_POST;
			$model = new SoModel();
			$result = $model->addSo($data);
			//如果成功，输出，转到列表页面
			if($result){
				echo '添加成功'.'<a href="Admin.php?c=So&m=society">如果没有跳转，请点这里跳转</a>';
				header("refresh:3;Admin.php?c=So&m=society = Admin.php?c=So&m=society"); 
			}else{
				echo '失败';
			}

		}
	}
 ?>